<style lang="less">
</style>
<template>
    <div class="search">
        <Row>
            <Col>
                <Card>
                    <Tabs value="name1" @on-click="changeTabs">
                        <TabPane label="见证人管理" name="name1">
                            <div v-show="witnessGroup">
                                <Form ref="witnessForm" :model="witnessForm" :label-width="150">
                                    <Row>
                                        <Table :loading="loading" border :columns="columns" :data="witnessData" sortable="custom"
                                               @on-sort-change="changeSort" @on-selection-change="showSelect" ref="table">

                                            <template slot-scope="{ row, index }" slot="witnessName">
                                                <span style="color: blue;" @click="see(row)">{{row.witnessName}}</span>
                                            </template>

                                            <template slot-scope="{ row, index }" slot="businessAttributes">
                                                <div v-if="row.businessAttributes == '0'">
                                                    新车
                                                </div>
                                                <div v-if="row.businessAttributes == '1'">
                                                    二手车
                                                </div>
                                            </template>

                                            <template slot-scope="{ row, index }" slot="status">
                                                <div v-if="row.status == '00'">
                                                    <Tag color="success" size="default">启用</Tag>
                                                </div>
                                                <div v-if="row.status == '01'">
                                                    <Tag color="warning" size="default">审核中</Tag>
                                                </div>
                                                <div v-if="row.status == '02'">
                                                    <Tag color="default" size="default">草稿</Tag>
                                                </div>
                                                <div v-if="row.status == '03'">
                                                    <Tag color="warning" size="default">退回</Tag>
                                                </div>
                                                <div v-if="row.status == '04'">
                                                    <Tag color="error" size="default">拒绝</Tag>
                                                </div>
                                                <div v-if="row.status == '05'">
                                                    <Tag color="error" size="default">已停用</Tag>
                                                </div>
                                            </template>
                                        </Table>
                                    </Row>
                                    <Row type="flex" justify="end" class="page">
                                        <Page :current="witnessForm.pageNumber" :total="witnessTotal" :page-size="witnessForm.pageSize"
                                              @on-change="changePage" @on-page-size-change="changePageSize" :page-size-opts="[10,20,50]"
                                              size="small" show-total show-elevator show-sizer>
                                        </Page>
                                    </Row>
                                </Form>
                            </div>
                        </TabPane>
                        <TabPane label="第三方挂靠单位管理" name="name2">
                            <div v-show="affiliationGroup">
                                <Form ref="affiliationForm" :model="affiliationForm" :label-width="150">
                                    <Row>
                                        <Button  @click="enableAffiliationForm" v-if="this.typeCode == '1'" type="success" icon="md-add-circle">批量启用</Button>
                                        <Button  @click="stopAffiliationForm" v-if="this.typeCode == '1'" type="error" icon="md-remove-circle">批量停用</Button>
                                    </Row>
                                    <Row>
                                        <Table :loading="loading" border :columns="columnsAffiliation" :data="data" sortable="custom"
                                               @on-sort-change="changeAffiliationSort" @on-selection-change="showAffiliationSelect" ref="table">
                                            <template slot-scope="{ row, index }" slot="affiliatedName">
                                                <a  type="primary" size="small" @click="show(row)">{{row.affiliatedName}}
                                                </a>
                                            </template>
                                            <template slot-scope="{ row, index }" slot="status">
                                                <div v-if="row.relationStatus === '00'">
                                                    <Tag color="success" size="default">启用</Tag>
                                                </div>
                                                <div v-else-if="row.relationStatus === '01'">
                                                    <Tag color="warning" size="default">审核中</Tag>
                                                </div>
                                                <div v-else-if="row.relationStatus === '02'">
                                                    <Tag color="default" size="default">草稿</Tag>
                                                </div>
                                                <div v-else-if="row.relationStatus === '03'">
                                                    <Tag color="warning" size="default">退回</Tag>
                                                </div>
                                                <div v-else-if="row.relationStatus === '04'">
                                                    <Tag color="error" size="default">拒绝</Tag>
                                                </div>
                                                <div v-else>
                                                    <Tag color="error" size="default">停用</Tag>
                                                </div>
                                            </template>
                                            <template slot-scope="{ row, index }" slot="busiType">
                                                <span>{{setBusiTypeTitle(row.busiType)}}</span>
                                            </template>
                                            <template slot-scope="{ row, index }" slot="whetherLicence">
                                                <div v-if="row.whetherLicence === '0'">
                                                    <Tag color="warning" size="default">否</Tag>
                                                </div>
                                                <div v-else-if="row.whetherLicence === '1'">
                                                    <Tag color="default" size="default">是</Tag>
                                                </div>
                                            </template>
                                        </Table>
                                    </Row>
                                    <Row type="flex" justify="end" class="page">
                                        <Page :current="affiliationForm.pageNumber" :total="total" :page-size="affiliationForm.pageSize"
                                              @on-change="changePageAffiliation" @on-page-size-change="changePageSizeAffiliation" :page-size-opts="[10,20,50]"
                                              size="small" show-total show-elevator show-sizer>
                                        </Page>
                                    </Row>
                                </Form>
                            </div>
                        </TabPane>
                        <TabPane label="合作车商" name="name3">
                            <div v-show="prodQuery">

                                <Form ref="carDealersTableForm" :model="carDealersTableForm" :label-width="150">
                                    <Row>
                                        <Button  @click="enableCarDealers" v-if="this.typeCode == '1'" type="success" icon="md-add-circle">批量启用</Button>
                                        <Button  @click="stopCarDealers" v-if="this.typeCode == '1'" type="error" icon="md-remove-circle">批量停用</Button>
                                    </Row>
                                    <Row>
                                        <Table :loading="loading" border :columns="columnsCarDealers" :data="carDealersData" sortable="custom"
                                               @on-sort-change="carDealersSort" @on-selection-change="carDealersSelect" ref="table">
                                            <template slot-scope="{ row, index }" slot="cardealerName">
                                                <div v-if="row.channelBelong == '01'">
                                                    <a type="primary" size="small" @click="showCardealerName(row)">{{row.cardealerName}}
                                                    </a>
                                                </div>
                                                <div v-else>
                                                    <a type="primary" size="small" @click="showName(row)">{{row.cardealerName}}
                                                    </a>
                                                </div>
                                            </template>
                                            <template slot-scope="{ row, index }" slot="status">
                                                <div v-if="row.status === '00'">
                                                    <Tag color="success" size="default">启用</Tag>
                                                </div>
                                                <div v-if="row.status === '05'">
                                                    <Tag color="error" size="default">停用</Tag>
                                                </div>
                                            </template>
                                            <template slot-scope="{ row, index }" slot="cardealerProperties">
                                                <div v-if="row.cardealerProperties === '0'">
                                                    <Tag color="success" size="default">汽贸</Tag>
                                                </div>
                                                <div v-else-if="row.cardealerProperties === '1'">
                                                    <Tag color="success" size="default">4S</Tag>
                                                </div>
                                                <div v-else>
                                                    <Tag color="success" size="default">其他</Tag>
                                                </div>
                                            </template>
                                        </Table>
                                    </Row>
                                    <Row type="flex" justify="end" class="page">
                                        <Page :current="carDealersTableForm.pageNumber" :total="carDealersTotal" :page-size="carDealersTableForm.pageSize"
                                              @on-change="changePageCarDealers" @on-page-size-change="changePageSizeCarDealers" :page-size-opts="[10,20,50]"
                                              size="small" show-total show-elevator show-sizer>
                                        </Page>
                                    </Row>
                                </Form>

                            </div>
                        </TabPane>
                        <TabPane label="网约车挂靠单位管理" name="name4">
                            <div v-show="netAffiliationGroup">
                                <Form ref="netAffiliationForm" :model="netAffiliationForm" :label-width="150">
                                    <Row>
                                        <Button  @click="enableNetAffiliationForm" v-if="this.typeCode == '1'" type="success" icon="md-add-circle">批量启用</Button>
                                        <Button  @click="stopNetAffiliationForm" v-if="this.typeCode == '1'" type="error" icon="md-remove-circle">批量停用</Button>
                                    </Row>
                                    <Row>
                                        <Table :loading="loading" border :columns="columnsNetAffiliation" :data="netData" sortable="custom"
                                               @on-sort-change="changeNetAffiliationSort" @on-selection-change="showNetAffiliationSelect" ref="table">
                                            <template slot-scope="{ row, index }" slot="netAffiliatedName">
                                                <a  type="primary" size="small" @click="showNet(row)">{{row.affiliatedName}}
                                                </a>
                                            </template>
                                            <template slot-scope="{ row, index }" slot="netStatus">
                                                <div v-if="row.relationStatus === '00'">
                                                    <Tag color="success" size="default">启用</Tag>
                                                </div>
                                                <div v-else-if="row.relationStatus === '01'">
                                                    <Tag color="warning" size="default">审核中</Tag>
                                                </div>
                                                <div v-else-if="row.relationStatus === '02'">
                                                    <Tag color="default" size="default">草稿</Tag>
                                                </div>
                                                <div v-else-if="row.relationStatus === '03'">
                                                    <Tag color="warning" size="default">退回</Tag>
                                                </div>
                                                <div v-else-if="row.relationStatus === '04'">
                                                    <Tag color="error" size="default">拒绝</Tag>
                                                </div>
                                                <div v-else>
                                                    <Tag color="error" size="default">停用</Tag>
                                                </div>
                                            </template>
                                            <template slot-scope="{ row, index }" slot="netBusiType">
                                                <span>{{setBusiTypeTitle(row.busiType)}}</span>
                                            </template>
                                        </Table>
                                    </Row>
                                    <Row type="flex" justify="end" class="page">
                                        <Page :current="netAffiliationForm.pageNumber" :total="netTotal" :page-size="netAffiliationForm.pageSize"
                                              @on-change="changePageNetAffiliation" @on-page-size-change="changePageSizeNetAffiliation" :page-size-opts="[10,20,50]"
                                              size="small" show-total show-elevator show-sizer>
                                        </Page>
                                    </Row>
                                </Form>
                            </div>
                        </TabPane>
                    </Tabs>
                </Card>
            </Col>
        </Row>
    </div>
</template>
<script>
    import {
        //见证人查询
        getWitnessUseChannel,
    } from "@/projects/afs-channel/api/witness/witness";

    import {
        getAffiliationByChannelId,disableAffiliatedRelation
    } from "@/projects/afs-channel/api/affiliation/affiliation";
    import {getCarDealersByChannelId,disableCarDealerRelation,disableDirectCarDealerRelation} from "@/projects/afs-channel/api/car-dealer/dealer";
    import {getDictDataByType} from "_p/basic/api/admin/datadic";
    export default {
        name: "recordInfoManage",
        components:{

        },
        data() {
            return {
                witnessGroup:true,//默认展示见证人管理
                affiliationGroup:true,//第三方挂靠
                prodQuery:true,//合作车商
                netAffiliationGroup:true,//网约车挂靠
                loading: true,
                operationLoading: false,
                importLoading: false,
                loadingExport: true,
                selectCount: 0,
                selectList: [],
                selectAffiliationCount:0,
                selectAffiliationList:[],
                selectNetAffiliationCount:0,
                selectNetAffiliationList:[],
                selectCarDealerCount: 0,
                typeCode:1,
                selectCarDealerList: [],
                busiTypeList:[],
                witnessForm: {
                    pageNumber: 1,
                    pageSize: 10,
                },
                affiliationForm:{
                    pageNumber: 1,
                    pageSize: 10,
                },
                carDealersTableForm:{
                    pageNumber: 1,
                    pageSize: 10,
                },
                netAffiliationForm:{
                    pageNumber: 1,
                    pageSize: 10,
                },
                selectDate: null,
                columns: [
                    {
                        type: 'index',
                        title:"序号",
                        minWidth: 80,
                        align: "center",
                        fixed: "left"

                    },
                    {
                        title: "见证人姓名",
                        key: "witnessName",
                        minWidth: 150,
                        slot:"witnessName"
                    },
                    {
                        title: "业务属性",
                        key: "businessAttributes",
                        minWidth: 155,
                        slot :"businessAttributes"
                    },
                    {
                        title: "身份证号码",
                        key: "witnessIdCard",
                        minWidth: 150
                    },
                    {
                        title: "电话号码",
                        key: "witnessContactNumber",
                        minWidth: 150
                    },
                    {
                        title: "状态显示",
                        key: "status",
                        minWidth: 150,
                        slot :"status"
                    },
                    {
                        title: "审核通过时间",
                        key: "approveTime",
                        minWidth: 150
                    },

                    {
                        title: "停用时间",
                        key: "ceaseTime",
                        minWidth: 150,
                    },
                    {
                        title: "授权有效期",
                        key: "witnessValidityAuthorization",
                        minWidth: 150,
                    },
                    {
                        title: "备注",
                        key: "remake",
                        minWidth: 150,
                    },
                ],
                columnsAffiliation: [
                    {
                        type: "selection",
                        minWidth: 60,
                        maxWidth:60,
                        align: "center",
                        fixed: "left"
                    },
                    {
                        title:'序号',
                        type: 'index',
                        width: 80,
                        align: 'center',
                        ellipsis: true,
                        tooltip: true
                    },
                    {
                        title: "挂靠类型",
                        key: "busiType",
                        align: "center",
                        minWidth: 120,
                        slot: "busiType"
                    },
                    {
                        title: "挂靠/运营公司名称",
                        key: "affiliatedName",
                        align: "center",
                        minWidth: 145,
                        slot:"affiliatedName"
                    },
                    {
                        title: "统一社会信用代码",
                        key: "socUniCrtCode",
                        align: "center",
                        minWidth: 140
                    },
                    {
                        title: "月单剩余数",
                        key: "monthlyApplicationNum",
                        align: "center",
                        minWidth: 120
                    },
                    {
                        title: "总单剩余数",
                        key: "totalApplicationNum",
                        align: "center",
                        minWidth: 120
                    },
                    {
                        title: "成立时间",
                        key: "foundedTime",
                        sortable: true,
                        align: "center",
                        minWidth: 150
                    },
                    {
                        title: "法人姓名",
                        key: "legalPersonName",
                        align: "center",
                        minWidth: 120
                    },
                    {
                        title: "注册地址",
                        key: "registeredAddress",
                        align: "center",
                        minWidth: 180
                    },
                    {
                        title: "注册资本",
                        key: "registeredCapital",
                        align: "center",
                        minWidth: 120
                    },
                    {
                        title: "是否道路运输许可",
                        key: "whetherLicence",
                        align: "center",
                        minWidth: 120,
                        slot:"whetherLicence"
                    },
                    {
                        title: "营业期限截止时间",
                        key: "oprTermValidity",
                        align: "center",
                        minWidth: 150
                    },
                    {
                        title: "状态",
                        key: "relationStatus",
                        align: "center",
                        minWidth: 100,
                        fixed: "right",
                        slot: "status"
                    }
                ],
                columnsNetAffiliation: [
                    {
                        type: "selection",
                        minWidth: 60,
                        maxWidth:60,
                        align: "center",
                        fixed: "left"
                    },
                    {
                        title:'序号',
                        type: 'index',
                        width: 80,
                        align: 'center',
                        ellipsis: true,
                        tooltip: true,
                        fixed: "left"
                    },
                    {
                        title: "挂靠类型",
                        key: "busiType",
                        align: "center",
                        minWidth: 120,
                        slot: "netBusiType",
                        fixed: "left"
                    },
                    {
                        title: "运营公司名称",
                        key: "affiliatedName",
                        align: "center",
                        minWidth: 145,
                        slot:"netAffiliatedName",
                        fixed: "left"
                    },
                    {
                        title: "统一社会信用代码",
                        key: "socUniCrtCode",
                        align: "center",
                        minWidth: 140
                    },
                    {
                        title: "已归档车证数量",
                        key: "",
                        align: "center",
                        minWidth: 140
                    },
                    {
                        title: "总合同量",
                        key: "",
                        align: "center",
                        minWidth: 140
                    },
                    {
                        title: "剩余未偿本金",
                        key: "",
                        align: "center",
                        minWidth: 140
                    },
                    {
                        title: "已还本金",
                        key: "",
                        align: "center",
                        minWidth: 140
                    },
                    {
                        title: "成立时间",
                        key: "foundedTime",
                        sortable: true,
                        align: "center",
                        minWidth: 150
                    },
                    {
                        title: "法人姓名",
                        key: "legalPersonName",
                        align: "center",
                        minWidth: 120
                    },
                    {
                        title: "注册地址",
                        key: "registeredAddress",
                        align: "center",
                        minWidth: 180,
                    },
                    {
                        title: "注册资本",
                        key: "registeredCapital",
                        align: "center",
                        minWidth: 120
                    },
                    {
                        title: "状态",
                        key: "relationStatus",
                        align: "center",
                        minWidth: 100,
                        fixed: "right",
                        slot: "netStatus"
                    }
                ],
                columnsCarDealers:[
                    {
                        type: "selection",
                        minWidth: 60,
                        maxWidth:60,
                        align: "center",
                        fixed: "left"
                    },
                    {
                        title: "车商名称",
                        minWidth: 120,
                        key: "cardealerName",
                        fixed: "left",
                        slot:"cardealerName"
                    },
                    {
                        title: "合作商名称",
                        minWidth: 145,
                        key: "channelFullName"
                    },
                    {
                        title: "法人姓名",
                        key: "corporateName",
                        minWidth: 120
                    },
                    {
                        title: "法人电话",
                        key: "telephoneNumber",
                        minWidth: 115
                    },

                    {
                        title: "车商类型",
                        key: "cardealerProperties",
                        minWidth: 150,
                        slot:"cardealerProperties"
                    },
                    {
                        title: "主要经营品牌",
                        key: "mainBrand",
                        minWidth: 150,
                        render: (h, params) => {
                            return h('div', [
                                h('span', {
                                    style: {
                                        display: 'inline-block',
                                        width: '100%',
                                        overflow: 'hidden',
                                        textOverflow: 'ellipsis',
                                        whiteSpace: 'nowrap'
                                    },
                                    domProps: {
                                        title: params.row.mainBrand
                                    }
                                }, params.row.mainBrand)
                            ])
                        }
                    },
                    {
                        title: "业务员",
                        key: "salesMan",
                        minWidth: 150,
                    },
                    {
                        title: "注册时间",
                        key: "registrationTime",
                        minWidth: 150,
                    },
                    {
                        title: "统一社会信用代码",
                        key: "socUniCrtCode",
                        minWidth: 140
                    },
                    {
                        title: "注册地址",
                        key: "address",
                        minWidth: 150
                    },
                    {
                        title: "状态",
                        key: "status",
                        minWidth: 100,
                        slot:"status"
                    },
                ],
                data: [],
                total: 0,
                witnessData:[],
                witnessTotal:0,
                carDealersData:[],
                carDealersTotal:0,
                netData:[],
                netTotal:0
            };
        },
        props:{
            channelId:{
                type:String,
            },
            channelType:{
                type:String,
            }
        },
        methods: {
            init() {
                this.initLabelType();
            },
            // 改变一页多少个
            changePage(v) {
                this.witnessForm.pageNumber = v;
                this.getWitnessList();
                this.clearSelectAll();
            },
            // 一页多少个
            changePageSize(v) {
                this.witnessForm.pageSize = v;
                this.getWitnessList();
            },
            // 改变一页多少个
            changePageAffiliation(v) {
                this.affiliationForm.pageNumber = v;
                this.getAffiliationList();
                this.clearSelectAll();
            },
            // 一页多少个
            changePageSizeAffiliation(v) {
                this.affiliationForm.pageSize = v;
                this.getAffiliationList();
            },
            // 改变一页多少个
            changeNetAffiliationSort(v){
                this.netAffiliationForm.pageNumber = v;
                this.getNetAffiliationList();
                this.clearSelectAll();
            },
            // 一页多少个
            changePageSizeNetAffiliation(v) {
                this.netAffiliationForm.pageSize = v;
                this.getNetAffiliationList();
            },
            // 改变一页多少个
            changePageNetAffiliation(v) {
                this.netAffiliationForm.pageNumber = v;
                this.getNetAffiliationList();
                this.clearSelectAll();
            },

            // 改变一页多少个
            changePageCarDealers(v) {
                this.carDealersTableForm.pageNumber = v;
                this.cooperationDealer();
                this.clearSelectAll();
            },
            // 一页多少个
            changePageSizeCarDealers(v) {
                this.carDealersTableForm.pageSize = v;
                this.cooperationDealer();
            },
            // 查找见证人
            getWitnessList(v) {
                // 多条件查询见证人列表
                this.loading = true;
                this.witnessForm.channelId=v;
                if(v ==null||v==""||v==undefined){
                    if(this.channelId){
                        this.witnessForm.channelId=this.channelId
                    }else{
                        this.loading = false;
                        return;
                    }

                }
                getWitnessUseChannel(this.witnessForm).then(res => {
                    this.loading = false;
                    if (res.code === "0000") {
                        this.witnessData = res.data.records;
                        this.witnessTotal = res.data.total;
                    }
                });

            },
            //查询条件
            getAffiliationList() {
                this.loading = true;
                let params = {
                    busiType: "01",
                    pageNumber: this.affiliationForm.pageNumber,
                    pageSize: this.affiliationForm.pageSize,
                    channelId:this.channelId
                };
                if(this.channelId ==null||this.channelId==""||this.channelId==undefined){
                    this.loading = false;
                    return;
                }
                getAffiliationByChannelId(params).then(res => {
                    this.loading = false;
                    if (res.code === "0000") {
                        this.data = res.data.records;
                        this.total = res.data.total;
                    }
                });
            },
            //查询条件
            getNetAffiliationList() {
                this.loading = true;
                let params = {
                    busiType: "03",
                    pageNumber: this.netAffiliationForm.pageNumber,
                    pageSize: this.netAffiliationForm.pageSize,
                    channelId:this.channelId
                };
                if(this.channelId ==null||this.channelId==""||this.channelId==undefined){
                    this.loading = false;
                    return;
                }
                getAffiliationByChannelId(params).then(res => {
                    this.loading = false;
                    if (res.code === "0000") {
                        this.netData = res.data.records;
                        this.netTotal = res.data.total;
                    }
                });
            },
            // 点击查看
            see(v){
                let params = {
                    id: v.id,
                    type: 3
                };
                this.afs.newTab(
                    this,
                    "projects/afs-channel/pages/witness/witness-add-edit/witnessAddEdit",
                    "见证人:"+v.witnessName,
                    "ios-add",
                    params,
                    "witness-see"+v.id,
                    [],
                    true
                );
            },

            showCardealerName(v){
                let param={
                    //按钮是否隐藏：保存、提交、隐藏，返回、黑名单展示
                    bottonView:1,
                    //信息是否只读:1 只读
                    infoView:0,
                    //操作类型：1，查看
                    operationType:2,
                    //车商id
                    channelId:v.id,
                    type:"0",
                    oldChannelId:v.channelId
                };
                this.afs.newTab(
                    this,
                    'projects/afs-channel/pages/car-dealer/direct-car-dealer/directCarDealerIndex',
                    '直营车商'+v.cardealerName+"查看",
                    'ios-add',
                    param,
                    'direct-cardealer-check'+v.id,
                    [],
                    true);
            },
            showName(v){
                let params = {
                    dealerId:v.id,
                    type: '0',
                    channelId:this.channelId
                };
                this.afs.newTab(
                    this,
                    'projects/afs-channel/pages/car-dealer/common-car-dealer/commonDealerCheck',
                    '普通车商'+v.cardealerName+"查看",
                    'ios-add',
                    params,
                    'common-cardealer-check'+v.id,
                    [],
                    true);
            },
            // 排序
            changeSort(e) {
                this.witnessForm.sort = e.key;
                this.witnessForm.order = e.order;
                if (e.order === "normal") {
                    this.witnessForm.order = "";
                }
                this.getWitnessList();
            },
            showSelect(e) {
                this.selectList = e;
                this.selectCount = e.length;
            },
            // 排序
            changeAffiliationSort(e) {
                this.affiliationForm.sort = e.key;
                this.affiliationForm.order = e.order;
                if (e.order === "normal") {
                    this.affiliationForm.order = "";
                }
                this.getAffiliationList();
            },
            // 排序
            carDealersSort(e) {
                this.carDealersTableForm.sort = e.key;
                this.carDealersTableForm.order = e.order;
                if (e.order === "normal") {
                    this.carDealersTableForm.order = "";
                }
                this.cooperationDealer();
            },


            showAffiliationSelect(e) {
                this.selectAffiliationList = e;
                this.selectAffiliationCount = e.length;
            },
            showNetAffiliationSelect(e){
                this.selectNetAffiliationList = e;
                this.selectNetAffiliationCount = e.length;
            },
            carDealersSelect(e) {
                this.selectCarDealerList = e;
                this.selectCarDealerCount = e.length;
            },
            showWitness() {
                this.witnessGroup=true;//见证人展示
                this.affiliationGroup=false;//挂靠隐藏
                this.prodQuery = false;//合作车商隐藏
                this.netAffiliationGroup=false;//网约车挂靠隐藏
                this.getWitnessList();
            },
            showAffiliation() {
                this.witnessGroup=false;//见证人隐藏
                this.affiliationGroup=true;//挂靠展示
                this.netAffiliationGroup=false;//网约车挂靠隐藏
                this.prodQuery = false;//合作车商隐藏
                this.getAffiliationList();
            },
            showNetAffiliation(){
                this.witnessGroup=false;//见证人隐藏
                this.affiliationGroup=false;//第三方挂靠隐藏
                this.prodQuery = false;//合作车商隐藏
                this.netAffiliationGroup=true;//网约车挂靠展示
                this.getNetAffiliationList();
            },
            show(v) {
                let param = {
                    type: 3,
                    id: v.id,
                    updateStatus: v.status
                }
                let turnPage = "affiliationThirdShow" + v.id;
                this.afs.newTab(this, 'projects/afs-channel/pages/affiliation-apply/affiliation-third/affiliationThirdAddEdit', '第三方挂靠查看', 'ios-view', param, turnPage, [], true);
            },
            showNet(v) {
                let param={
                    type:3,
                    id:v.id,
                    updateStatus:v.status
                }
                let turn="affiliationNetCarShow"+v.id;
                this.afs.newTab(this,'projects/afs-channel/pages/affiliation-apply/affiliation-netcar/affiliationNetCarAddEdit','网约车挂靠修查看','ios-view',param,turn,[],true)
            },
            clearSelectAll() {
                this.$refs.table.selectAll(false);
            },
            //合作车商
            cooperationDealer(){
                this.witnessGroup=false;//见证人隐藏
                this.affiliationGroup=false;//挂靠隐藏
                this.prodQuery = true;
                let params = {
                    pageNumber: this.carDealersTableForm.pageNumber,
                    pageSize: this.carDealersTableForm.pageSize,
                    channelId:this.channelId
                };
                this.loading = true;
                if(this.channelId ==null||this.channelId==""||this.channelId==undefined){
                    this.loading = false;
                    return;
                }
                getCarDealersByChannelId(params).then(res=>{
                    if(res.code === "0000"){
                        this.loading = false;
                        this.carDealersData = res.data.records;
                        this.carDealersTotal = res.data.total;
                    }
                })
            },
            changeTabs(v){
                console.log(v);
                if(v=="name1"){
                    this.showWitness();
                }else if(v=="name2"){
                    this.showAffiliation();
                }else if(v=="name3"){
                    this.cooperationDealer();
                }else if(v=="name4"){
                    this.showNetAffiliation();
                }
            },
            //挂靠类型
            setBusiTypeTitle(val){
                if(val==null ||val=="" ||val ==undefined){
                    return;
                }
                let dic = {};
                this.busiTypeList.forEach(column => {
                    if(column.value === val){
                        dic = column;
                    }
                });
                return dic.title;
            },
            initLabelType(){
                let affiliatedWayDic="affiliatedWay";
                getDictDataByType(affiliatedWayDic).then(res =>{
                    if (res.code === "0000"){
                        this.busiTypeList = res.data;
                    }
                });
            },
            stopCarDealers(){
                if (this.selectCarDealerCount <= 0) {
                    this.$Message.warning("您还未选择要停用的车商");
                    return;
                }
                let status = false;
                this.selectCarDealerList.forEach(function (e) {
                    console.log("/////////",e)
                    if(e.status != '00'){
                        status = true;
                    }
                });
                if(status){
                    this.$Message.warning("只能停用已启用的车商");
                    return;
                }
                this.$Modal.confirm({
                    title: "确认停用",
                    content: "您确认要停用所选的 " + this.selectCarDealerCount + " 条数据?",
                    onOk: () => {
                        let ids = [];
                        this.selectCarDealerList.forEach(function (e) {
                            ids += e.id + ",";
                        });
                        ids = ids.substring(0, ids.length - 1);
                        this.operationLoading = true;
                        //表示停用
                        let status="05";
                        if(this.channelType=="01"){
                            //直营车商停用
                            disableDirectCarDealerRelation(ids,this.channelId,status).then(res => {
                                this.operationLoading = false;
                                if (res.code === "0000") {
                                    this.$Message.success("停用成功");
                                    this.cooperationDealer();
                                }
                            });
                        }else{
                            disableCarDealerRelation(ids,this.channelId,status).then(res => {
                                this.operationLoading = false;
                                if (res.code === "0000") {
                                    this.$Message.success("停用成功");
                                    this.cooperationDealer();
                                }
                            });
                        }

                    }
                })
            },
            enableCarDealers(){
                if (this.selectCarDealerCount <= 0) {
                    this.$Message.warning("您还未选择要启用的车商");
                    return;
                }
                let status = false;
                this.selectCarDealerList.forEach(function (e) {
                    if(e.status != '05'){
                        status = true;
                    }
                });
                if(status){
                    this.$Message.warning("只能启用已停用的车商");
                    return;
                }
                this.$Modal.confirm({
                    title: "确认启用",
                    content: "您确认要启用所选的 " + this.selectCarDealerCount + " 条数据?",
                    onOk: () => {
                        let ids = [];
                        this.selectCarDealerList.forEach(function (e) {
                            ids += e.id + ",";
                        });
                        ids = ids.substring(0, ids.length - 1);
                        this.operationLoading = true;
                        //启用方法
                        let status="00";
                        if(this.channelType=="01"){
                            //直营车商启用
                            disableDirectCarDealerRelation(ids,this.channelId,status).then(res => {
                                this.operationLoading = false;
                                if (res.code === "0000") {
                                    this.$Message.success("启用成功");
                                    this.cooperationDealer();
                                }
                            });
                        }else{
                            disableCarDealerRelation(ids,this.channelId,status).then(res => {
                                this.operationLoading = false;
                                if (res.code === "0000") {
                                    this.$Message.success("启用成功");
                                    this.cooperationDealer();
                                }
                            });
                        }

                    }
                })
            },
            stopAffiliationForm(){
                if (this.selectAffiliationCount <= 0) {
                    this.$Message.warning("您还未选择要停用的第三方挂靠单位");
                    return;
                }
                let status = false;
                this.selectAffiliationList.forEach(function (e) {
                    if(e.relationStatus != '00'){
                        status = true;
                    }
                });
                if(status){
                    this.$Message.warning("只能停用已启用的第三方挂靠");
                    return;
                }
                this.$Modal.confirm({
                    title: "确认停用",
                    content: "您确认要停用所选的 " + this.selectAffiliationCount + " 条数据?",
                    onOk: () => {
                        let ids = "";
                        this.selectAffiliationList.forEach(function (e) {
                            ids += e.id + ",";
                        });
                        ids = ids.substring(0, ids.length - 1);
                        this.operationLoading = true;
                        //表示停用
                        let status="05";
                        //第三方挂靠单位停用
                        let param={
                            ids:ids,
                            channelId:this.channelId,
                            status:status
                        }
                        disableAffiliatedRelation(param).then(res => {
                            this.operationLoading = false;
                            if (res.code === "0000") {
                                this.$Message.success("停用成功");
                                this.getAffiliationList();
                            }
                        });
                    }
                })
            },
            enableAffiliationForm(){
                if (this.selectAffiliationCount <= 0) {
                    this.$Message.warning("您还未选择要启用的第三方挂靠单位");
                    return;
                }
                let status = false;
                this.selectAffiliationList.forEach(function (e) {
                    if(e.relationStatus != '05'){
                        status = true;
                    }
                });
                if(status){
                    this.$Message.warning("只能启用已停用的第三方挂靠");
                    return;
                }
                this.$Modal.confirm({
                    title: "确认启用",
                    content: "您确认要启用所选的 " + this.selectAffiliationCount + " 条数据?",
                    onOk: () => {
                        let ids = "";
                        this.selectAffiliationList.forEach(function (e) {
                            ids += e.id + ",";
                        });
                        ids = ids.substring(0, ids.length - 1);
                        this.operationLoading = true;
                        //表示停用
                        let status="00";
                        //第三方挂靠单位停用
                        let param={
                            ids:ids,
                            channelId:this.channelId,
                            status:status
                        }
                        disableAffiliatedRelation(param).then(res => {
                            this.operationLoading = false;
                            if (res.code === "0000") {
                                this.$Message.success("启用成功");
                                this.getAffiliationList();
                            }
                        });
                    }
                })
            },
            stopNetAffiliationForm(){
                if (this.selectNetAffiliationCount <= 0) {
                    this.$Message.warning("您还未选择要停用的网约车挂靠单位");
                    return;
                }
                let status = false;
                this.selectNetAffiliationList.forEach(function (e) {
                    if(e.relationStatus != '00'){
                        status = true;
                    }
                });
                if(status){
                    this.$Message.warning("只能停用已启用的网约车挂靠");
                    return;
                }
                this.$Modal.confirm({
                    title: "确认停用",
                    content: "您确认要停用所选的 " + this.selectNetAffiliationCount + " 条数据?",
                    onOk: () => {
                        let ids = "";
                        this.selectNetAffiliationList.forEach(function (e) {
                            ids += e.id + ",";
                        });
                        ids = ids.substring(0, ids.length - 1);
                        this.operationLoading = true;
                        //表示停用
                        let status="05";
                        //网约车挂靠单位停用
                        let param={
                            ids:ids,
                            channelId:this.channelId,
                            status:status
                        }
                        disableAffiliatedRelation(param).then(res => {
                            this.operationLoading = false;
                            if (res.code === "0000") {
                                this.$Message.success("停用成功");
                                this.getNetAffiliationList();
                            }
                        });
                    }
                })
            },
            enableNetAffiliationForm(){
                if (this.selectNetAffiliationCount <= 0) {
                    this.$Message.warning("您还未选择要启用的网约车挂靠单位");
                    return;
                }
                let status = false;
                this.selectNetAffiliationList.forEach(function (e) {
                    if(e.relationStatus != '05'){
                        status = true;
                    }
                });
                if(status){
                    this.$Message.warning("只能启用已停用的网约车挂靠");
                    return;
                }
                this.$Modal.confirm({
                    title: "确认启用",
                    content: "您确认要启用所选的 " + this.selectNetAffiliationCount + " 条数据?",
                    onOk: () => {
                        let ids = "";
                        this.selectNetAffiliationList.forEach(function (e) {
                            ids += e.id + ",";
                        });
                        ids = ids.substring(0, ids.length - 1);
                        this.operationLoading = true;
                        //表示停用
                        let status="00";
                        //网约车挂靠单位启用
                        let param={
                            ids:ids,
                            channelId:this.channelId,
                            status:status
                        }
                        disableAffiliatedRelation(param).then(res => {
                            this.operationLoading = false;
                            if (res.code === "0000") {
                                this.$Message.success("启用成功");
                                this.getNetAffiliationList();
                            }
                        });
                    }
                })
            },
            readOnlyInfo(b) {
                let _this=this;
                this.$nextTick(()=>{
                    _this.typeCode=b;
                })
            },
        },
        mounted() {
            this.init();
        },
    };
</script>
